#ifndef MDS_DENSITY_INCLUDED
#define MDS_DENSITY_INCLUDED 1


#include "./vector.h"

typedef struct
{
	size_t num_particles; /*!< for one frame     **/
	size_t num_points;    /*!< 2 + num_particles **/
	Real  *X;             /*!< num_points        **/
	Real  *F;             /*!< cumulative        **/
	Real  *f;             /*!< density           **/
	Real  *wX;            /*!< smoothing window  **/
	Real  *wF;            /*!< smoothing values  **/
} mds_density;

#define MDS_DENSITY_INIT { 0, 0, NULL, NULL }

int  mds_density_load( mds_density *rho, size_t num_particles);
void mds_density_quit( mds_density *rho );

/** \brief build a density profile 
 *
 *	\param rho a valid density struct.
 *	\param data rho->num_particles coodinates.
 */
void mds_density_build( mds_density *rho, const mds_vector *data, const mds_vector *box, Real width);

/** \brief interpolate cumulative density
 */
Real mds_density_F( const mds_density *rho, Real x );


#endif
